package com.schoolvisitors.repository;

import com.schoolvisitors.entity.RoleResource;

import com.schoolvisitors.enums.ResourceTypeEnum;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ResourcesRepository extends JpaRepository<RoleResource, Long> {
    List<RoleResource> findByRoleId(Long roleId);

    RoleResource findByRoleIdAndTypeAndResourceIndex(Long id, @NotNull ResourceTypeEnum type, @NotNull Long resourceIndex);

    boolean existsByRoleIdAndTypeAndResourceIndex(Long roleId, ResourceTypeEnum type, Long roomId);
}
